From: Andreas Schwab Date: Fri, 20 Feb 2009 14:24:55 +0000 (+0000) Subject: (command-line): Don't match an empty argument as an X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1~1^2~421^2~1662 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=0d1b3a235a9184404160d84256b148d3504176fe;p=emacs.git (command-line): Don't match an empty argument as an option. (command-line-1): Likewise. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a4b43afc163..9ba81c5abcc 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2009-02-20 Andreas Schwab + + * startup.el (command-line): Don't match an empty argument as an + option. + (command-line-1): Likewise. + 2009-02-20 Daniel Jensen (tiny change) * apropos.el (apropos-library): Check for null filename in load-history. diff --git a/lisp/startup.el b/lisp/startup.el index 22a9fa02103..7a1f9dc392d 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -828,10 +828,10 @@ opening the first frame (e.g. open a connection to an X server).") (orig-argi argi) argval) ;; Handle --OPTION=VALUE format. - (when (string-match "^\\(--[^=]*\\)=" argi) + (when (string-match "\\`\\(--[^=]*\\)=" argi) (setq argval (substring argi (match-end 0)) argi (match-string 1 argi))) - (unless (equal argi "--") + (when (string-match "\\`--." orig-argi) (let ((completion (try-completion argi longopts))) (if (eq completion t) (setq argi (substring argi 1)) @@ -2125,21 +2125,20 @@ A fancy display is used on graphic displays, normal otherwise." (setq argi "") ;; Convert long options to ordinary options ;; and separate out an attached option argument into argval. - (when (string-match "^\\(--[^=]*\\)=" argi) + (when (string-match "\\`\\(--[^=]*\\)=" argi) (setq argval (substring argi (match-end 0)) argi (match-string 1 argi))) - (if (equal argi "--") - (setq completion nil) - (setq completion (try-completion argi longopts))) - (if (eq completion t) - (setq argi (substring argi 1)) - (if (stringp completion) - (let ((elt (assoc completion longopts))) - (or elt - (error "Option `%s' is ambiguous" argi)) - (setq argi (substring (car elt) 1))) - (setq argval nil - argi orig-argi)))) + (when (string-match "\\`--." orig-argi) + (setq completion (try-completion argi longopts)) + (if (eq completion t) + (setq argi (substring argi 1)) + (if (stringp completion) + (let ((elt (assoc completion longopts))) + (or elt + (error "Option `%s' is ambiguous" argi)) + (setq argi (substring (car elt) 1))) + (setq argval nil + argi orig-argi))))) ;; Execute the option. (cond ((setq tem (assoc argi command-switch-alist))